package com.example.zg.zg_312_ordering_new.model;

import com.example.zg.zg_312_ordering_new.activity.FoodInfoActivity;
import com.example.zg.zg_312_ordering_new.beans.LoginBean;
import com.example.zg.zg_312_ordering_new.beans.Result;
import com.example.zg.zg_312_ordering_new.common.Constants;

import com.example.zg.zg_312_ordering_new.listener.RetrofitListener;
import com.example.zg.zg_312_ordering_new.services.PurchaseService;
import com.example.zg.zg_312_ordering_new.services.UserService;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class UserModel extends RetrofitBaseModel{
    private UserService userService;
    private PurchaseService purchaseService;

    public UserModel(){
        this.userService=retrofit.create(UserService.class);
    }
    public void userLogin(String username,String password,final RetrofitListener listener){
        Call call=userService.userLogin(username,password);
        bindCallback(call,listener,Constants.USERLOGIN);
    }
    public void register(String username,String userpass,String mobilenum,String address,
                         String comment,final RetrofitListener listener){
        Call call=userService.register(username,userpass,mobilenum,address,comment);
        bindCallback(call,listener,Constants.USEREGISTER);
    }


    public void userCollect(int user_id,int food_id,final RetrofitListener listener){
        Call call=userService.userCollectFood(user_id,food_id);
        bindCallback(call,listener,Constants.USERCOLLECTFOOD);
    }
    //
    //
    public void getUserById(int user_id,final RetrofitListener listener){
        Call call=purchaseService.getUserById(user_id);
        bindCallback(call,listener,Constants.GETUSERBYID);
    }

}




